import java.sql.Time;


public class FlightSegment {
	
	private long flightSegmentID;
	private String flightNo;
	private double price;
	private Time departureTime;
	private Time arrivalTime;
	
	private Airport toAirport;
	private Airport fromAirport;
	private Airline airline;
	private PlaneModel planeModel;

    private boolean idSet = false;
	
	public FlightSegment(String flightNo, Airline airline){
		this.flightNo = flightNo;
		this.airline = airline;	
	}
	
	public FlightSegment(String flightNo, Airline airline, double price, Time departureTime, Time arrivalTime, 
			Airport fromAirport, Airport toAirport, PlaneModel planeModel) {
		this(flightNo,airline);
		
		this.price = price;
		this.departureTime = departureTime;
		this.arrivalTime = arrivalTime;
		this.fromAirport = fromAirport;
		this.toAirport = toAirport;
		this.planeModel = planeModel;
		
	}
    
	public void setFlightSegmentID(long flightSegmentID) {
		this.flightSegmentID = flightSegmentID;
        idSet = true;
	}
    
	public long getFlightSegmentID() {
		return flightSegmentID;
	}

    public boolean isIdSet() {
        return idSet;
    }
    
	public void setFlightNo(String flightNo) {
		this.flightNo = flightNo;
	}
    
	public String getFlightNo() {
		return flightNo;
	}
    
	public void setPrice(double price) {
		this.price = price;
	}
    
	public double getPrice() {
		return price;
	}
    
	public void setDepartureTime(Time departureTime) {
		this.departureTime = departureTime;
	}
    
	public Time getDepartureTime() {
		return departureTime;
	}
    
	public void setArrivalTime(Time arrivalTime) {
		this.arrivalTime = arrivalTime;
	}
    
	public Time getArrivalTime() {
		return arrivalTime;
	}
    
	public void setToAirport(Airport toAirport) {
		this.toAirport = toAirport;
	}
    
	public Airport getToAirport() {
		return toAirport;
	}
    
	public void setFromAirport(Airport fromAirport) {
		this.fromAirport = fromAirport;
	}
    
	public Airport getFromAirport() {
		return fromAirport;
	}
    
	public void setAirline(Airline airline) {
		this.airline = airline;
	}
    
	public Airline getAirline() {
		return airline;
	}
    
	public void setPlaneModel(PlaneModel planeModel) {
		this.planeModel = planeModel;
	}
    
	public PlaneModel getPlaneModel() {
		return planeModel;
	}
	
	@Override
	public boolean equals(Object fs) {
		if (fs instanceof FlightSegment) {
			FlightSegment fsOther = (FlightSegment) fs;
			return ((fsOther.getFlightNo().equals(flightNo)) && (fsOther.getAirline().getCode().equals(airline.getCode())));
		}
		return false;
	}

    @Override
    public int hashCode() {
        return flightNo.hashCode() ^ airline.getCode().hashCode();
    }

}

